<extend name="public:base"/>

<block name="main">

    <div class="newsMainCenter">
        <div class="userCenterHeader">
            <div class="i_item i_userInfo a78">
                <div class="userName">
                    登录用户名：<span class="af90">{:session('user_auth.username')}</span>
                </div>
                <div class="userPhone mt15">
                    上次登录时间：<span class="af90">2018-09-15</span>
                </div>
                <div class="userPhone mt15">
                    上次登录IP：<span class="af90">127.0.0.1</span>
                </div>

                <a href="{:url('user/safe/add_ress')}" class="btn_b autoBtn">收货地址</a>
            </div>

            <div class="i_item i_otherFunds">
                <p class="a999 l20 f14">账户总资产(元) </p>

                <div class="h34 f30 fa l30 af90 mt10">{$user->Money->money_collect + $user->Money->money_freeze +
                    $user->Money->account_money}
                </div>

                <dl class="fl mt20 mr15">
                    <dt class="a999">待收总额(元) <span class="iconFont a999 f14" id="icon2">&#xe6a0;</span></dt>
                    <dd class="f20 l28"> {$user->Money->money_collect}</dd>
                </dl>
                <dl class="fl mt20">
                    <dt class="a999">待收本金(元)</dt>
                    <dd class="f20 l28">{$user->Money->money_collect}</dd>
                </dl>
                <dl class="fl mr15">
                    <dt class="a999">冻结金额(元) <span class="iconFont a999 f14" id="icon3">&#xe6a0;</span></dt>
                    <dd class="f20 l28">{$user->Money->money_freeze}</dd>
                </dl>
                <dl class="fl">
                    <dt class="a999">累计收益(元)<span class="iconFont a999 f14" id="icon4">&#xe6a0;</span></dt>
                    <dd class="f20 l28">{$total_interest|default='0.00'}</dd>
                </dl>
            </div>

            <div class="i_item i_available">
                <p class="a999 l20 f14">可用余额(元)</p>
                <div class="h34 f30 fa l30 af90 mt10"> {$user->Money->account_money}</div>
                <div class="cl f16 mt15">
                    <a href="{:url('user/recharge/index')}" class="ui-btm ui-btm-f60 fl">充值</a>
                    <a href="{:url('user/withdraw/index')}" class="ui-btm ui-btm-f60 ui-btm-with fl">提现</a>
                </div>
            </div>
            <div class="cl"></div>
        </div>


        <div class="i_investGlance">
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="tableBlue">
                <tbody>
                <tr>
                    <th class="first">项目名称</th>
                    <th>购买总金额</th>
                    <th>购买预付款</th>
                    <th>购买剩余款</th>
                    <th>购买时间</th>
                    <th>购买状态</th>
                    <th>操作</th>
                </tr>

                <notempty name="list">
                    <volist name="list" id="v">
                        <tr class="tc">

                            <td class="first">
                                <a href="{:url('index/invest/detail',['id'=>$v['borrow_id']])}" target="_blank">
                                    {$v.borrow_name}</a>
                            </td>
                            <td>{$v.invest_capital}</td>
                            <td>{$v.prepay_money}</td>
                            <td>{$v.remain_money}</td>
                            <td>{$v.create_time}</td>
                            <td>{$v.status_name}</td>
                            <td>
                                <if $v.status eq 1>
                                    <a data-href="{:url('user/invested/ready')}" data-id="{$v['id']}"
                                       class="btn af60 readyOrder" style="cursor: pointer;">确认下单</a>
                                </if>
                            <td/>
                        </tr>
                    </volist>
                    <else/>
                    <td colspan="7" class="text-center"> 暂无内容</td>
                </notempty>

                </tbody>
            </table>
        </div>

    </div>


</block>


<block name="js">

    <script type="text/javascript">

        $(function () {

            //确定下单
            $('.readyOrder').on('click', function () {

                var _this = $(this);
                var id = _this.attr('data-id');
                if (id.length < 1) {
                    alert('参数不可为空');
                    return false;
                }
                var href = _this.attr('data-href');

                $.post(href, {id: id}, function (data) {

                    if (data.code) {
                        alert(data.msg);
                        window.location.href = data.url;
                        return false;
                    } else {
                        alert(data.msg);
                        return false;
                    }
                }, 'json');
                return false;
            });

        });

        // function cancel_debt(id) {
        //     // 取消询问框
        //     layer.confirm('是否取消转让？', {
        //         btn: ['确定', '取消'] //按钮
        //     }, function (index) {
        //         layer.close(index);
        //         $.post("{:url('uc/debt/cancel')}", {id: id}, function (data) {
        //             if (data.code == 1) {
        //                 function toLink() {
        //                     window.location.href = "{:url('uc/invest/index')}";
        //                 }
        //
        //                 layer.alert(data.msg, {icon: 1}, function (ins) {
        //                     toLink();
        //                     layer.close(ins);
        //                     return false;
        //                 });
        //                 setTimeout(toLink, 1500);
        //                 return false;
        //             } else {
        //                 layer.alert(data.msg, {icon: 2});
        //                 return false;
        //             }
        //         });
        //     }, function () {
        //         layer.closeAll();
        //     });
        // }
    </script>
</block>
